import request from "@/utils/request";
const defaultApi = (apiName) => {
    return {
        list: (params) => request.get(`/${apiName}/list`, { params }),
        page: (params) => request.get(`/${apiName}`, { params }),
        read: (id) => request.get(`/${apiName}/` + id),
        create: (id, data) => request.post(`/${apiName}`, data),
        update: (id, data) => request.put(`/${apiName}/` + id, { ...data, create_time: undefined, id: undefined }),
        delete: (id) => request.delete(`/${apiName}/` + id)
    }
}
export const http = {
    form: defaultApi('form'),
    login: (data) => request.post('/Auth/login', data),
    // 商户信息
    merchant: (params) =>  request.get('/User/merchantinfo', { params }),
    // 资金流水明细
    financePage: (params) => request.post('/Finance/record', params),
    updatePassword: data => request.post('/User/password', data),
    // 更新支付密码
    updatePayPassword: data => request.post('/User/paypassword', data),
    // 登陆记录/api/User/loginlog
    loginRecord: (params) => request.post('/User/loginlog', params),
    // 提现配置信息
    withdrawConfig: (params) => request.post('/Transfer/info', params),
    // 提现
    withdraw: data => request.post('/USDT/transfer', data),
    // 查询汇率
    exchangeRate: (params) => request.get('/USDT/rate', { params }),

    /**
     * 分页
     */
    // 代收订单
    collectOrderPage: (params) => request.post('/Collect/record', params),
    // 代付订单
    payOrderPage: (params) => request.post('/Pay/record', params),
    // 提现记录
    withdrawPage: (params) => request.post('/Transfer/record', params),
}
